
$(function(){
	
	function validate_login(accNo,pwd){
		if(accNo == null || accNo == ''){
			alert("账号不能为空!");
			return false;
		}
		if(pwd == null || pwd == ''){
			alert("密码不能为空!");
			return false;
		}
		return true;
	}
	$("#login").click(function(){
		var accountNo = $("#accountNo").val();
		var pwd = $("#pwd").val();
		
		if(!validate_login(accountNo,pwd)){
			return false;
		}
		$.ajax({
	        url: 'login/login.htm',
	        data:{accountno:accountNo,pwd:pwd},
	        type: "POST",
	        dataType: "json",
	        cache:false, 
			ifModified :true,
	        success: function(data) {
	           if(data.code == 1){
	        	   alert("登录成功");
	        	   alert(JSON.stringify(data.data));
	        	   alert("123");
	        	   window.location.href = "index.htm";
	           }else{
	        	   alert(data.msg)
	           }
	        },
	        error:function(e){
	        	alert(e);
	        }
	    });
		
	});
	
});


function login(){
	alert("login");
	var accountNo = $("#accountNo").val();
	var pwd = $("#pwd").val();
	alert("accountNo:" + accountNo);
	alert("pwd:" + pwd);
}
